package org.spring.springboot.app.adv.advscreeninfo.domain.vo;

import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;
import org.spring.springboot.util.DateUtil;

import java.util.Date;

public class AdvScreenInfoForSystemSaveInVO {

    private static final long serialVersionUID = -1L;
    @ApiModelProperty(value = "id", hidden = false)
    private String id;
    @ApiModelProperty(value = "标题", hidden = false)
    private String title;
    @ApiModelProperty(value = "图片", hidden = false)
    private String photos;
    @ApiModelProperty(value = "开始时间(例如2017-01-01)", hidden = false)
    private String startDate;
    @ApiModelProperty(value = "结束时间(例如2017-01-01)", hidden = false)
    private String endDate;
    @ApiModelProperty(value = "内容", hidden = false)
    private String content;
    @ApiModelProperty(value = "播放方式 1轮播 2条件", hidden = false)
    private Integer reward;
    @ApiModelProperty(value = "性别 0不限制 1男 2女", hidden = false)
    private Integer sex;
    @ApiModelProperty(value = "最小年龄", hidden = false)
    private Integer minAge;
    @ApiModelProperty(value = "最大年龄", hidden = false)
    private Integer maxAge;
    @ApiModelProperty(value = "音频地址", hidden = false)
    private String voice;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getPhotos() {
        return photos;
    }

    public void setPhotos(String photos) {
        this.photos = photos;
    }

    public String getStartDate() {
        return startDate;
    }

    public Date getStartDate_() {
        if(StringUtils.isBlank(this.startDate)){
            return new Date();
        }
       return DateUtil.strToDate(this.startDate +" 00:00:00");
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getEndDate() {
        return endDate;
    }
    public Date getEndDate_() {
        if(StringUtils.isBlank(this.endDate)){
            return new Date();
        }
        return DateUtil.strToDate(this.endDate +" 23:59:59");
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getReward() {
        return reward;
    }

    public void setReward(Integer reward) {
        this.reward = reward;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public Integer getMinAge() {
        return minAge;
    }

    public void setMinAge(Integer minAge) {
        this.minAge = minAge;
    }

    public Integer getMaxAge() {
        return maxAge;
    }

    public void setMaxAge(Integer maxAge) {
        this.maxAge = maxAge;
    }

    public String getVoice() {
        return voice;
    }

    public void setVoice(String voice) {
        this.voice = voice;
    }


    public int getZoneDay(){
        if (startDate == null || endDate == null) {
            return 0;
        }
        return DateUtil.zoneDays(getStartDate_(),getEndDate_());
    }
}